@layout("/common/_curd/_container.html"){

<script type="text/javascript">
	var ctx = "${basePath}";
	var grid_selector = "#grid-table";
	var pager_selector = "#grid-pager";

	$(function(){
		initGrid();
		initMenuBtn("btns", "${code}");
	});

	function initGrid(){
		var grid_url = ctx + "/${code}/list";
		var _colnames = ["项目名称",
			"申报单位",
			"联系人",
			"责任单位",
			"建设起止年限",
			"建设结束时间",
			"预算（万）",
			"联系电话",
			"申报进度",
			"操作"
		];
		var _colmodel = [{name:"name", index:"name", width:100,formatter:function (value, row, index) {
            return '<a href="#" class="btn btn-btn btn-info btn-xs" onclick="viewPop('+"'"+index.id+"'"+')">'+value+'</a>';
        }},
			{name:"fullname", index:"fullname", width:100},
			{name:"contact", index:"contact", width:100},
			{name:"responsible", index:"responsible", width:100},
			{name:"start", index:"start", width:100,formatter:function (value, row, index) {
				var over = index.over;
				var start = value;
				if(start !== null && over!==null){
					return start.substr(0,7)+" 至 "+over.substr(0,7);
				}else{
					return "未录入";
				}
			}},
			{name:"over", index:"over", width:100,hidden:true},
			{name:"budget", index:"budget", width:100},
			{name:"phone", index:"phone", width:100},
			{name:"dict", index:"status", width:100 },
//			{name:"status", index:"status", width:100 ,},
			{name:"temarks", width:200,formatter:function (value,row,index) {
				var status = index.status
				if(status === 0){
					return '<a href="#" class="btn btn-btn btn-danger btn-xs" onclick="back('+"'"+index.id+"'"+')">'+"初审退回"+'</a> &nbsp;<a href="#" class="btn btn-btn btn-success btn-xs" onclick="pass('+"'"+index.id+"'"+')">'+"初审通过"+'</a>';
				}else if(status === 3){
					return '<a href="#" class="btn btn-btn btn-success btn-xs" onclick="l_choosExpert('+"'"+index.id+"'"+')">'+"通过方案"+'</a>&nbsp;' +
							'<a href="#" class="btn btn-btn btn-success btn-xs" onclick="back('+"'"+index.id+"'"+')">'+"退回"+'</a>';
				}else if(status === 5){
					return '<a href="#" class="btn btn-btn btn-success btn-xs" onclick="l_choosExpert('+"'"+index.id+"'"+')">'+"选择专家"+'</a>';
				}else if(status === 6){
					return '<a href="#" class="btn btn-btn btn-success btn-xs" onclick="l_choosExpert2('+"'"+index.id+"'"+')">'+"重新选择专家"+'</a>';
				}else if(status === 7){
					return '<a href="#" class="btn btn-btn btn-success btn-xs" onclick="view('+"'"+index.id+"'"+')">'+"查看专家意见"+'</a>';
				}else if(status === 8){
					return '<a href="#" class="btn btn-btn btn-success btn-xs" onclick="pass2('+"'"+index.id+"'"+')">'+"会商审核通过"+'</a>&nbsp;' +
							'<a href="#" class="btn btn-btn btn-success btn-xs" onclick="back('+"'"+index.id+"'"+')">'+"不通过"+'</a>';
				}else if(status === 13){
					return '<a href="#" class="btn btn-btn btn-success btn-xs" onclick="l_download('+"'"+index.id+"'"+')">'+"下载招标文件"+'</a>&nbsp;' +
							'<a href="#" class="btn btn-btn btn-success btn-xs" onclick="setstatus('+"'"+index.id+"'"+')">'+"通过立项"+'</a>&nbsp;' +
							'<a href="#" class="btn btn-btn btn-success btn-xs" onclick="back('+"'"+index.id+"'"+')">'+"退回"+'</a>';
				}else if(status === 17){
					return '<a href="#" class="btn btn-btn btn-success btn-xs" onclick="setstatus('+"'"+index.id+"'"+')">'+"通过中期检查"+'</a>&nbsp;' +
							'<a href="#" class="btn btn-btn btn-success btn-xs" onclick="back('+"'"+index.id+"'"+')">'+"退回"+'</a>';
				}else if(status === 19){
					return '<a href="#" class="btn btn-btn btn-success btn-xs" onclick="overs('+"'"+index.id+"'"+')">'+"竣工验收操作"+'</a>&nbsp;' +
							'<a href="#" class="btn btn-btn btn-success btn-xs" onclick="back('+"'"+index.id+"'"+')">'+"退回"+'</a>';

				}else {
					return" ";
				}

			}}
		];

		jQuery(grid_selector).jqGrid({
			url : grid_url,
			shrinkToFit : true,
			colNames : _colnames,
			colModel : _colmodel,
			jsonReader : {id :"id"},
			pager : pager_selector,
			postData : {sort : "id", order : "desc"}
		});
	}
	l_download = function (entId) {
		window.location.href="/myproject/download?id="+ entId;
	};
	back = function (entId) {

		window.location.href="/listexpert/tohs?status=97&&id="+ entId;
	};
	setstatus = function (entId) {

		window.location.href="/listcom/setstatus/"+ entId + "-15"
	};
	pass = function (entId) {
		layer.msg('确定通过审核吗？', {
			time: 0 //不自动关闭
			,btn: ['确定','取消']
			,yes: function(){
				window.location.href="/projects/auditOk?id="+ entId;
			}
		});
	};
	pass2 = function (entId) {
		window.location.href="/listexpert/tohs?status=9&&id="+ entId;
	};
	view = function (entId) {
		window.location.href="/listexpert/view/"+ entId;
	};
    function viewPop(pid){
        var index = layer.open({
            type: 2,
            title:'查看详情',
            area: ['90%', '70%'],
            maxmin:true,
            shadeClose: true, //点击遮罩关闭

            content:  '/projects/view?id=' + pid
        });

        this.layerIndex = index;
    }
	l_choosExpert = function (entId) {
		window.location.href= '/projects/chooseExpert?has=1&&id='+ entId
	};
	l_choosExpert2 = function (entId) {
		window.location.href= '/projects/chooseExpert?has=2&&id='+ entId
	};
	overs = function (entId) {
		window.location.href= '/over/view?id='+ entId
	};
</script>


<!-- 配置 grid -->
<div class="row">
	<div class="col-xs-12 tb-grid">
		<!-- 配置 查询 -->
		@ var _col=[
		@		{name:"主键", index:"id", type:"text"},
		@		{name:"申报单位", index:"dept_id", type:"text"},
		@		{name:"联系人", index:"contact", type:"text"},
		@		{name:"联系电话", index:"phone", type:"text"},
		@		{name:"责任单位", index:"responsible", type:"text"},
		@		{name:"建设开始时间", index:"start", type:"text"},
		@		{name:"建设结束时间", index:"over", type:"text"},
		@		{name:"预算（万）", index:"budget", type:"text"},
		@		{name:"备注", index:"temarks", type:"text"}
		@];
		@ include("/common/_function/_search.html",{"col":_col}){}
		<!-- 按钮 -->
		<!--<div class="welljq well-sm" id="btns"></div>-->
		<!-- grid -->
		<table id="grid-table"></table>
		<!-- 分页-->
		<div id="grid-pager"></div>
	</div>
</div>

<!-- 引入所需的js -->
@include("/common/_listscript.html"){}

@}	